tools/python: Python 3 compatibility
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 18 Dec 2019 14:00:16 +0000 (14:00 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 20 Dec 2019 11:19:56 +0000 (11:19 +0000)
commit1430c5a8cad45d689b035255f3d7ca6a07ae02e4
tree74622f9bf2842d61a0f2b50ca56e8c81dcac1929
parent25164571fc11ed3010c5885a98a68fac3b891d33
tools/python: Python 3 compatibility

convert-legacy-stream is only used for incomming migration from pre Xen 4.7,
and verify-stream-v2 appears to only be used by me during migration
development - it is little surprise that they missed the main converstion
effort in Xen 4.13.

Fix it all up.

Move open_file_or_fd() into a new util.py to avoid duplication, making it a
more generic wrapper around open() or fdopen().

In libxc.py, drop all long() conversion.  Python 2 will DTRT with int => long
promotion, even on 32bit builds.

In convert-legacy-stream, don't pass empty strings to write_record().  Join on
the empty argl will do the right thing.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
tools/python/scripts/convert-legacy-stream
tools/python/scripts/verify-stream-v2
tools/python/xen/__init__.py
tools/python/xen/lowlevel/__init__.py
tools/python/xen/migration/libxc.py
tools/python/xen/migration/libxl.py
tools/python/xen/migration/verify.py
tools/python/xen/util.py [new file with mode: 0644]